﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ConnectionStrings.aspx.cs" Inherits="SampleApplication.ConnectionStrings" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:GridView runat="server" ID="ConnectionStringsDisplay"></asp:GridView>
    <br/>
    <br/>
    <asp:GridView runat="server" ID="ConnectionStringTests"></asp:GridView>
    <br />
    Cat Breeds Sample Table<br/>
    <br/>
    <asp:GridView runat="server" ID="SampleCatTable" AllowPaging="True" 
        AutoGenerateColumns="False" DataSourceID="SampleControllerForCats"
        DataKeyNames="Id"
        >
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ShowSelectButton="True" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="DateCreated" HeaderText="DateCreated" 
                SortExpression="DateCreated" />
            <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
            <asp:BoundField DataField="Cuteness" HeaderText="Cuteness" 
                SortExpression="Cuteness" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
            <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
        </Columns>
        <EmptyDataTemplate>
            I got nothing. No rows returned.
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:ObjectDataSource ID="SampleControllerForCats" runat="server" 
        DataObjectTypeName="SampleApplication.Code.CatBreeds" DeleteMethod="Delete" 
        InsertMethod="Insert" SelectMethod="SelectList" 
        TypeName="SampleApplication.Code.SampleController" UpdateMethod="Update"
        >
        
        <DeleteParameters>
            <asp:Parameter Name="Id" Type="Int64" />
        </DeleteParameters>
        
        <SelectParameters>
            <asp:Parameter DefaultValue="0" Name="from" Type="Int32" />
            <asp:Parameter DefaultValue="0" Name="to" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:FormView runat="server" ID="InsertForm" DefaultMode="Insert" 
        DataSourceID="SampleControllerForCats" DataKeyNames="Id">
        <EditItemTemplate>
            Name:
            <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
            <br />
            DateCreated:
            <asp:TextBox ID="DateCreatedTextBox" runat="server" 
                Text='<%# Bind("DateCreated") %>' />
            <br />
            Price:
            <asp:TextBox ID="PriceTextBox" runat="server" Text='<%# Bind("Price") %>' />
            <br />
            Cuteness:
            <asp:TextBox ID="CutenessTextBox" runat="server" 
                Text='<%# Bind("Cuteness") %>' />
            <br />
            Description:
            <asp:TextBox ID="DescriptionTextBox" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />
            Id:
            <asp:TextBox ID="IdTextBox" runat="server" Text='<%# Bind("Id") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <InsertItemTemplate>
            Name:
            <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
            <br />
            DateCreated:
            <asp:TextBox ID="DateCreatedTextBox" runat="server" 
                Text='<%# Bind("DateCreated") %>' />
            <br />
            Price:
            <asp:TextBox ID="PriceTextBox" runat="server" Text='<%# Bind("Price") %>' />
            <br />
            Cuteness:
            <asp:TextBox ID="CutenessTextBox" runat="server" 
                Text='<%# Bind("Cuteness") %>' />
            <br />
            Description:
            <asp:TextBox ID="DescriptionTextBox" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />
            Id:
            <asp:TextBox ID="IdTextBox" runat="server" Text='<%# Bind("Id") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </InsertItemTemplate>
        <ItemTemplate>
            Name:
            <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
            <br />
            DateCreated:
            <asp:Label ID="DateCreatedLabel" runat="server" 
                Text='<%# Bind("DateCreated") %>' />
            <br />
            Price:
            <asp:Label ID="PriceLabel" runat="server" Text='<%# Bind("Price") %>' />
            <br />
            Cuteness:
            <asp:Label ID="CutenessLabel" runat="server" Text='<%# Bind("Cuteness") %>' />
            <br />
            Description:
            <asp:Label ID="DescriptionLabel" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />
            Id:
            <asp:Label ID="IdLabel" runat="server" Text='<%# Bind("Id") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Edit" />
            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Delete" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New" />
        </ItemTemplate>
        
    </asp:FormView>
    <br />
</asp:Content>
